<template>
  <div>
      <div class="top">
            <Mimore/>
      </div>
      <div class="center">
          <h4>正在众筹</h4>
          <p style="font-size:13px;color:rab(153,153,153);margin-top:0px">寻觅世间9款好物，只为精致你的生活</p>
      </div>
        <Being
         v-for="(v,i) in this.$store.state.beingstore.arr" 
         :key="i"
         :img="v.img"
         :name="v.name"
         :title="v.title"
         :price="v.price"/>
        <div class="lll">
            <img src="https://img.youpin.mi-img.com/jianyu/e7c20c2be747e5203f8406d458bb08f0.png@base@tag=imgScale&h=84&m=1&q=80&w=750" alt="" @click="funa()">
        </div>
  </div>
</template>

<script>
import Mimore from "@/components/crow/mimore"
import List from "@/components/home/list"
import Being from "@/components/crow/being"
export default {
    created () {
        //在页面加载时读取localStorage里的状态信息
        if (localStorage.getItem("data") ) {
            //replaceState替换数据 Object.assign合并对象
            this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(localStorage.getItem("data"))))
        } 
        //在页面刷新时将vuex里的信息保存到localStorage里
        window.addEventListener("beforeunload",()=>{
            localStorage.setItem("data",JSON.stringify(this.$store.state))
        })
      },

    components:{
        Mimore,Being
    },
    methods: {
        funa(){
            this.$router.push("./past")
        }
    },
}
</script>

<style scoped>
.lll{
    height: 100px;
}
.lll img{
    width: 375px;
    height: 42px;
}
html{
    background-color: yellow;
}
</style>